package com.tian.controller.pay;

import com.tian.common.annotation.LoginCheckAnnotation;
import com.tian.common.util.CommonResult;
import com.tian.dto.pay.OrderUseCouponDto;
import com.tian.dto.pay.UserBalanceRespDto;
import com.tian.service.pay.QueryPayOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * {@code @description:} 支付单查询接口
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2025-01-20 10:15
 * {@code @version:} 1.0
 */
@Slf4j
@RestController
@RequestMapping("/pay/payment/query")
public class QueryPayOrderController {

    @Resource
    private QueryPayOrderService queryPayOrderService;
    @GetMapping("/{orderId}")
    public CommonResult<List<OrderUseCouponDto>> query(@PathVariable Long orderId) {
        return queryPayOrderService.queryOrderUseCoupon(orderId);
    }

    @LoginCheckAnnotation
    @GetMapping("/balance")
    public CommonResult<UserBalanceRespDto> queryBalance() {
        return queryPayOrderService.queryBalance();
    }
}
